<?php

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

class BakerysModelBakery extends JModelItem
{
	function getItem()
	{
		$db = JFactory::getDbo();
		$query = $db->getQuery(true);
		$input = JFactory::getApplication()->input;
		$location_id = $input->get("location");
		$productid = $input->get("id");
		$query->select("i.*,li.price as location_price")
			->from("#__bakery_items i")
			->leftJoin("#__bakery_location_items li on li.item_id = i.id and location_id = $location_id")
			->where("i.state = 1 and i.id = $productid");
		$db->setQuery($query);
		return $db->loadObject();
	}
	
}
